package com.lzx.adx.report.model.hb;

import com.lzs.adx.commmon.utils.JsonUtils;
import com.lzx.adx.report.dto.ReportDTO;
import com.lzx.adx.report.model.common.CommonReportRequest;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

@Data
public class HaiBeiRequest {

    private String dspId;
    private String campaignId;

    private String adgroupId;

    private String contentId;
    private String channel;
    private String imei;

    private String imeiMd5;

    private String oaid;


    private String oaidMd5;


    private String ip;

    private String ua;

    /**
     * 格式为毫秒
     */
    private String ts;
    /**
     * AndroidId
     */
    private String aid;

    public ReportDTO builderReportDTO(){
        ReportDTO reportDTO = new ReportDTO();
        reportDTO.setDspId(this.dspId );
        if (StringUtils.isBlank(ts)){
            reportDTO.setTraceTime(String.valueOf(System.currentTimeMillis()));
        }
        reportDTO.setIp(this.ip);
        reportDTO.setOaid(this.oaid);
        reportDTO.setCampaignId(this.campaignId);
        reportDTO.setAdgroupId(this.adgroupId);
        reportDTO.setContentId(this.contentId);
        reportDTO.setChannel("hb");
        reportDTO.setTagId("hb");
        reportDTO.setEventType("click");
        reportDTO.setImei(this.imei);
        reportDTO.setUser_agent(this.ua);
        reportDTO.setExtend(JsonUtils.toJsonString(this));
        return reportDTO;

    }

}
